﻿<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Office Online - Web Collaboration System</title>
    <link rel="Stylesheet" href="css/main.css"  type="text/css"/>
    <link rel="Stylesheet" href="css/CalendarControl.css" type="text/css">
    <script type="text/javascript" src="js/Attatchment.js"></script>
    <script type="text/javascript" src="js/CalendarControl.js"></script>
    <script type="text/javascript" src="js/UrlEncodeDecode.js"></script>
    <script type="text/javascript" src="js/SideBarResizer.js"></script>
    <script type="text/javascript" src="js/ViewportDimension.js"></script>
    <script type="text/javascript" src="js/Notes.js"></script>
    <script type="text/javascript" src="js/Reminders.js"></script>
    <script type="text/javascript" src="js/Links.js"></script>
    <script type="text/javascript" src="js/Tasks.js"></script>
    <script type="text/javascript" src="js/Desktop_Chat.js"></script>
    <script type="text/javascript" src="js/Desktop_Reminder.js"></script>    
    
    <script type="text/javascript">
        function showGroup(group) {
            
            var arr = document.getElementsByTagName("div");
            
            for(var i=0;i<arr.length;i++)
            {
                if(arr[i].id.indexOf("groupItems") > -1)
                {
                    arr[i].style.display = "none";
                }
            }
            
            document.getElementById(group).style.display = "block";
        }

        function loadXMLDoc(url) {
            if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
                //try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
                //catch (e) {
                    xmlhttp = new XMLHttpRequest();
                //}
            }
            else {// code for IE6, IE5
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.open("GET", url, false);
            xmlhttp.send(null);
            var elem = document.getElementById('content');
            //alert(xmlhttp.responseText);
            elem.style.display = '';
            document.getElementById('frmContent').style.display = 'none';
            elem.innerHTML = xmlhttp.responseText;

            //always check reminders regardless of the page the user is viewing!
        }


        function LogOut() {
            document.getElementById('txtusername').value = document.getElementById('txtCurrentUser').value;
            document.getElementById('frmLogout').submit();
        }


        function loadIframe(url) {
            var elem = document.getElementById('content');
            elem.style.display = 'none';

            var frmContent = document.getElementById('frmContent');
            var height = getViewPortHeight() - document.getElementById('divHeader').offsetHeight - 10;
            var width = getViewPortWidth() - document.getElementById('groupItems1').offsetWidth - 10;
            frmContent.style.height = height + 'px';
            frmContent.style.width = width + 'px';
            frmContent.src = url;
            frmContent.style.display = '';
        }
    </script>
    
</head>
<body style="position: absolute; margin: 0 0 0 0;width:100%">
    
        <form runat="server">
            <asp:HiddenField ID="txtCurrentUser" runat="server"/>
            
            <div id="divChatWindowPopup" style="position:absolute; display:none;border:solid 1px gray">            
                
            </div>
        </form>
        <div id="divCreateUserScripts" runat="server" visible="false">
            <script type="text/javascript" src="js/UserCreation.js"></script>
        </div>
        
        <div id="divManageUserScripts" runat="server" visible="false">
             <script type="text/javascript" src="js/UserManagement.js"></script>
        </div>
        
        <div runat="server" visible="true" style="top:-5000px;left:-5000px;position:absolute">
            <textarea id="debugBox" runat="server" cols="100" rows="10" />
        </div>
        
        <div id="divReminderGrid" style="top:-4000px;left:-4000px;position:absolute">
        </div>
        
        <div id="Chat_OnlineUsersDiv" runat="server" style="width:200px;border:solid 1px gray;top:-4000px;left:-4000px;position:absolute">        
        </div> 
        
        
        
        <div id="divHeader">
            <table border="0" cellpadding="0" cellspacing="0" id="tblHeader">
                <tr>
                    <td align="left">
                        <h1>Office Online Web Collaboration System</h1>
                    </td>
                    <td align="right">
                        Logged In as:
                        <asp:Label id="lblUser" runat="server" Text="" ForeColor="Yellow" ></asp:Label>&nbsp;&nbsp;
                        <input type="button" id="btnLogout" value="Log Out" 
                             onclick="javascript:LogOut();" style="width:55px"/>
                    </td>
                </tr>
            </table>
        </div>
        
        <div runat="server" id="chatWindowsBar" style="width:300px;position:absolute;">
              
        </div>
        
        <div runat="server" id="chatBar" style="width:300px;border:solid 1px gray;position:absolute;">
              
        </div>
                           
       <%-- <table border="0" cellpadding="0" cellspacing="0" style="width:100%; ">
            <tr>
             <td style="width:100px">--%>
              <table border="0" cellpadding="0" cellspacing="0" style="width:100%;" id="tblMain">
                <tr>
                    <td valign="top">
                        <div id="heading1" class="heading" onclick="javascript:showGroup('groupItems1');">
                            <p>Personal</p>
                        </div>    
                        <div class="groupItems" id="groupItems1">
                            <table border="0" id="tdgroupItems1" cellpadding="0" cellspacing="0" style="text-align:center; width:100%;">
                                <tr>
                                    <td>
                                        <img alt="Desktop" src="images/sidebar_desktop.gif" 
                                             style="left: 25px; height: 32px; width: 32px;" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <p>Desktop</p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <img alt="My Contacts" src="images/sidebar_contacts.gif" 
                                             style="height: 32px; width: 32px;" onclick="loadIframe('Contact/ContactPage.aspx');" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <p>My Contacts</p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <img alt="My Calendar" src="images/sidebar_calendar.gif" 
                                             style="height: 32px; width: 32px;" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <p>My Calendar</p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <img alt="My Documents" src="images/sidebar_documents.gif" 
                                             style="height: 32px; width: 32px;" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <p>My Documents</p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <img alt="Mail" src="images/sidebar_mail.gif" 
                                        style="height: 32px; width: 32px;" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <p>Mail</p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <img alt="My Tasks" src="images/sidebar_tasks.gif" 
                                             style="height: 32px; width: 32px;"  onclick="loadXMLDoc('Personal/Tasks.aspx')"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <p>My Tasks</p>
                                    </td>
                                </tr>
                                <tr onclick="loadXMLDoc('Personal/Links.aspx')">
                                    <td>
                                        <img alt="My Links" src="images/sidebar_links.gif" 
                                        style="height: 32px; width: 32px;"  onclick="loadXMLDoc('Personal/Links.aspx')"/>
                                    </td>
                                </tr>
                                <tr onclick="loadXMLDoc('Personal/Links.aspx')">
                                    <td>
                                        <p>My Links</p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                       <img alt="Notes" src="images/sidebar_notes.gif" 
                                            style="height: 32px; width: 32px;" onclick="loadXMLDoc('Personal/Notes.aspx');"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <p>Notes</p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <img alt="Reminders" src="images/sidebar_reminders.gif" 
                                             style="height: 32px; width: 32px;" onclick="loadXMLDoc('Personal/Reminders.aspx');"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <p>Reminders</p>
                                    </td>
                                </tr>
                                <tr style="height:100%"><td>&nbsp;</td></tr>
                            </table>
                           
                        </div>
                        <div id="divAdmin" runat="server" visible="false">
                            <div id="heading2" class="heading" onclick="javascript:showGroup('groupItems2');">
                                <p>Administration</p>
                            </div>    
                            <div class="groupItems" id="groupItems2" style="display:none">
                                <table border="0" id="tdgroupItems2" cellpadding="0" cellspacing="0" style="text-align:center; width:100%">
                                    <tr>
                                        <td>
                                            <img alt="Add User" src="images/adduser.png" 
                                                 style="left: 25px; height: 32px; width: 32px;"  onclick="loadXMLDoc('Administration/AddUser.aspx');"/>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <p onclick="loadXMLDoc('Administration/AddUser.aspx');">Add User</p>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <img alt="Manage Users" src="images/sidebar_subscriptions.gif" 
                                                 style="left: 25px; height: 32px; width: 32px;"  onclick="loadXMLDoc('Administration/ManageUsers.aspx');"/>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <p onclick="loadXMLDoc('Administration/ManageUsers.aspx');">Manage Users</p>
                                        </td>
                                    </tr> 
                                    <tr style="height:100%"><td>&nbsp;</td></tr>
                                </table>          
                            </div>
                        </div>
                    </td>
                    <td style="width:100%;"  valign="top">
                        <table style="width:100%;height:auto" border=0>
                         <tr style="height:90%">
                          <td>
                           <div id="content">
                    
                            </div>    
                          </td>
                         </tr>
                         <tr style="height:30px">
                          <td>
                           <%--<div id="chatBar" style="width:100%;border:solid 1px;" align="right">
                            <input type="button" runat="server" id="chatbutton" value="Chat" onclick="showOnlineUsers()"/>
                           </div>--%>
                          </td>
                         </tr>         
                        </table>         
                        <iframe id="frmContent"  style="display:none;"></iframe>
                    </td>
                  </tr>
                </table>     
            <%--</td>
            <td valign=bottom>
                
            </td>
          </tr>
        </table>--%>
       
        
        
    <iframe id="frmUploader" src="AjaUtils/AjaxUploader.aspx"  style="width:0px; height: 0px; line-height: 0px"></iframe>
    
    <form id="frmLogout" method="post" action="../login.aspx" style="display:none">
          <input type="text" name="txtLogout"  id="txtLogout" value="1" />
          <input type="text" name="txtusername" id="txtusername" />
    </form>
</body>
<script type="text/javascript">
    
    /*this is the resize event for the page, add any resizing function here*/
    function ResizeEvent() {
        ResizeHeader();
        ResizeSidebar();
        relocateChatBar();
        relocateChatWindowsBar();
        relocateOnlineUsersDiv();
        try {
            ResizeEditPopup();
            
        } catch (ex) {
        }
    }

    window.onresize = ResizeEvent;
    window.onload = ResizeEvent;
    
    
    

    setTimeout("checkReminders()", 5000);
    setTimeout("loadOnlineUsers()", 1000);
    setTimeout("loadChatBar()", 3000);
    loadChatWindow('AjaUtils/ChatWindowBox.aspx');
</script>
</html>

